package com.hycloud.cloudstack.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.hycloud.cloudstack.model.Template;
import com.hycloud.cloudstack.repository.TemplateRepository;
import com.hycloud.cloudstack.service.TemplateService;

@Service
public class TemplateServiceImpl implements TemplateService {
	@Autowired
	private  TemplateRepository templateRepository;

	
	/**
	 * 保存模板
	 */
	public void save(Template template){
		templateRepository.save(template);
	}
    /**
     * 根据id查询模板
     */
	@Override
	public Template find(String id) {
		// TODO Auto-generated method stub
		return templateRepository.findOne(id);
		
	}

    /**
     * 查询所有的模板的数据
     */
	@Override
	public List<Template> queryAllTemplate() {
		// TODO Auto-generated method stub
		return templateRepository.findAll();
	}
   /**
    * 查询模板总的数量
    */
	@Override
	public int templateCount() {
		// TODO Auto-generated method stub
		return ((Long)templateRepository.count()).intValue();
	}

 
	
	

}
